//
//  YFSwingDetailItem.m
//  PaddleTennisDemo
//
//  Created by Coollang on 2017/10/13.
//  Copyright © 2017年 Coollang-YF. All rights reserved.
//

#import "YFSwingDetailItem.h"

@implementation YFSwingDetailItem
// 硬件返回的数据
- (void)swingDetailItemFormDeviceDict:(NSDictionary *)dict {
    self.actionType = [dict[@"actionType"] integerValue];
    self.swingSpeed = [dict[@"swingSpeed"] integerValue];
    self.strength = [dict[@"strength"] floatValue];
    self.hitBallTime = [dict[@"hitBallTime"] integerValue];
    
    self.timeStamp = [dict[@"timeStamp"] longLongValue];
    self.swingTime = [dict[@"swingTime"] integerValue];
    self.isHitBall = [dict[@"isHitBall"] boolValue];
    self.areaValue = [dict[@"areaValue"] integerValue];
    self.handType = [dict[@"handType"] integerValue];
    self.serveDirectionType = [dict[@"serveDirectionType"] integerValue];
    self.handBallType = [dict[@"handBallType"] integerValue];
    self.indexK = [dict[@"indexK"] integerValue];
    
    self.indentation = [NSString stringWithFormat:@"%lld_%ld",self.timeStamp,(long)self.indexK];
}
// 服务器返回的数据
- (void)swingDetailItemFormServerDict:(NSDictionary *)dict {
    self.actionType = [dict[@"AT"] integerValue];
    self.swingSpeed = [dict[@"S"] integerValue];
    self.strength = [dict[@"P"] floatValue];
    self.hitBallTime = [dict[@"JT"] integerValue];
    
    self.timeStamp = [dict[@"TAMP"] longLongValue];
    self.swingTime = [dict[@"ST"] integerValue];
    self.isHitBall = [dict[@"T"] boolValue];
    self.areaValue = [dict[@"AR"] integerValue];
    self.handType = [dict[@"HT"] integerValue];
    self.serveDirectionType = [dict[@"SDT"] integerValue];
    self.handBallType = [dict[@"UDT"] integerValue];
    self.indexK = [dict[@"I"] integerValue];
    self.indentation = [NSString stringWithFormat:@"%lld_%ld",self.timeStamp,(long)self.indexK];
}
// 上传到服务器的数据
- (NSDictionary *)swingDetailItemToDict {
    NSDictionary *dict = @{
                           @"AT":@(self.actionType),
                           @"S":@(self.swingSpeed),
                           @"P":@(self.strength),
                           @"ST":@(self.swingTime),
                           @"JT":@(self.hitBallTime),
                           @"T":@(self.isHitBall),
                           @"AR":@(self.areaValue),
                           @"HT":@(self.handType),
                           @"SDT":@(self.serveDirectionType),
                           @"UDT":@(self.handBallType),
                           @"TAMP":@(self.timeStamp),
                           @"I":@(self.indexK)
                           };
    return dict;
}


@end
